﻿namespace zijian666.DI;

/// <summary>
/// 绑定配置项特性
/// </summary>
/// <param name="defaultEnable"></param>
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class BindConfigurationAttribute(bool defaultEnable) : Attribute
{
    /// <summary>
    /// 默认启用
    /// </summary>
    public bool DefaultEnable { get; } = defaultEnable;

    /// <summary>
    /// 配置项Key
    /// </summary>
    public string? ConfigurationKeyName { get; set; }

    internal bool Disabled => !DefaultEnable;
}
